#include "FifoLectura.h"

FifoLectura::FifoLectura(const std::string nombre) :
		Fifo(nombre) {
}

FifoLectura::~FifoLectura() {
}

void FifoLectura::abrir() throw (CantOpenException) {
	fd = open(nombre.c_str(), O_RDONLY);
	if (fd < 0) {
		throw(CantOpenException());
	}
}

ssize_t FifoLectura::leer(void* buffer, const ssize_t buffsize) const
		throw (CantReadException) {
	int readResult = read(fd, buffer, buffsize);
	if (readResult <= 0) {
		throw(CantReadException());
	}
	return readResult;
}
